import socket
import sys

host = '127.0.0.1'
port = 1234
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host,port))
print 'Connected to server... type a message'
while 1:
    x = raw_input()
    s.send(x)
    #s.send('hello')
    data = s.recv(1024)
    #s.close()
    print 'Echo:' , repr(data)
    if x == "stop":
        break

s.close()
print "connection closed"     

    
